#  Copyright (c) 2014-present, Facebook, Inc.
#  All rights reserved.
#
#  This source code is licensed as defined on the LICENSE file found in the
#  root directory of this source tree.

load("//tools/build_defs/oss/osquery:cxx.bzl", "osquery_cxx_library")
load("//tools/build_defs/oss/osquery:native.bzl", "osquery_target")
load("//tools/build_defs/oss/osquery:platforms.bzl", "LINUX", "MACOSX", "POSIX", "WINDOWS")
load("//tools/build_defs/oss/osquery:third_party.bzl", "osquery_tp_target")

osquery_cxx_library(
    name = "main",
    srcs = [
        "main.cpp",
    ],
    header_namespace = "osquery/main",
    exported_headers = [
        "main.h",
    ],
    platform_deps = [
        (
            LINUX,
            [
                osquery_target("plugins/logger:aws_firehose"),
                osquery_target("plugins/logger:aws_kinesis"),
                osquery_target("plugins/logger:aws_log_forwarder"),
                osquery_target("plugins/logger:kafka_producer"),
            ],
        ),
        (
            MACOSX,
            [
                osquery_target("plugins/logger:aws_firehose"),
                osquery_target("plugins/logger:aws_kinesis"),
                osquery_target("plugins/logger:aws_log_forwarder"),
                osquery_target("plugins/logger:kafka_producer"),
            ],
        ),
        (
            WINDOWS,
            [
                osquery_target("plugins/logger:aws_firehose"),
                osquery_target("plugins/logger:aws_kinesis"),
                osquery_target("plugins/logger:aws_log_forwarder"),
                osquery_target("plugins/logger:windows_event_log"),
            ],
        ),
    ],
    platform_srcs = [
        (
            POSIX,
            [
                "posix/main.cpp",
            ],
        ),
        (
            WINDOWS,
            [
                "windows/main.cpp",
            ],
        ),
    ],
    visibility = ["PUBLIC"],
    deps = [
        osquery_target("osquery:headers"),
        osquery_target("osquery/core:core"),
        osquery_target("osquery/core/plugins:plugins"),
        osquery_target("osquery/core/sql:core_sql"),
        osquery_target("osquery/database:database"),
        osquery_target("osquery/devtools:devtools"),
        osquery_target("osquery/dispatcher:dispatcher"),
        osquery_target("osquery/experimental/events_stream:events_stream_registry"),
        osquery_target("osquery/experimental/tracing:syscalls_tracing"),
        osquery_target("osquery/extensions:extensions"),
        osquery_target("osquery/extensions:impl_thrift"),
        osquery_target("osquery/logger:data_logger"),
        osquery_target("osquery/process:process"),
        osquery_target("osquery/numeric_monitoring:numeric_monitoring"),
        osquery_target("osquery/registry:registry"),
        osquery_target("osquery/remote/enroll:tls_enroll"),
        osquery_target("osquery/sql:sql"),
        osquery_target("plugins/config:filesystem_config"),
        osquery_target("plugins/config:tls_config"),
        osquery_target("plugins/config/parsers:parsers"),
        osquery_target("plugins/config:update_config_plugin"),
        osquery_target("plugins/database:ephemeral"),
        osquery_target("plugins/database:rocksdb_plugin"),
        osquery_target("plugins/database:sqlite_plugin"),
        osquery_target("plugins/distributed:tls_distributed"),
        osquery_target("plugins/logger:buffered"),
        osquery_target("plugins/logger:filesystem_logger"),
        osquery_target("plugins/logger:stdout"),
        osquery_target("plugins/logger:syslog"),
        osquery_target("plugins/logger:tls_logger"),
        osquery_target("plugins/numeric_monitoring:numeric_monitoring_filesystem"),
        osquery_target("plugins/remote/enroll:tls_enroll_plugin"),
        osquery_target("specs:tables"),
        osquery_tp_target("boost"),
    ],
)
